package com.example.showlocation;

import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.location.Location;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.tencent.map.lib.models.IndoorCellInfo;
import com.tencent.map.sdk.comps.vis.VisualLayer;
import com.tencent.map.sdk.comps.vis.VisualLayerOptions;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
import com.tencent.tencentmap.mapsdk.maps.CustomRender;
import com.tencent.tencentmap.mapsdk.maps.LocationSource;
import com.tencent.tencentmap.mapsdk.maps.Projection;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.TencentMapComponent;
import com.tencent.tencentmap.mapsdk.maps.TencentMapContext;
import com.tencent.tencentmap.mapsdk.maps.TencentMapInitializer;
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
import com.tencent.tencentmap.mapsdk.maps.VisualSettings;
import com.tencent.tencentmap.mapsdk.maps.model.AoiLayer;
import com.tencent.tencentmap.mapsdk.maps.model.AoiLayerOptions;
import com.tencent.tencentmap.mapsdk.maps.model.Arc;
import com.tencent.tencentmap.mapsdk.maps.model.ArcOptions;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
import com.tencent.tencentmap.mapsdk.maps.model.Circle;
import com.tencent.tencentmap.mapsdk.maps.model.CircleOptions;
import com.tencent.tencentmap.mapsdk.maps.model.CustomLayer;
import com.tencent.tencentmap.mapsdk.maps.model.CustomLayerOptions;
import com.tencent.tencentmap.mapsdk.maps.model.GroundOverlay;
import com.tencent.tencentmap.mapsdk.maps.model.GroundOverlayOptions;
import com.tencent.tencentmap.mapsdk.maps.model.IOverlay;
import com.tencent.tencentmap.mapsdk.maps.model.Language;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.LatLngBounds;
import com.tencent.tencentmap.mapsdk.maps.model.MapFontSize;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
import com.tencent.tencentmap.mapsdk.maps.model.OverSeaTileProvider;
import com.tencent.tencentmap.mapsdk.maps.model.Polygon;
import com.tencent.tencentmap.mapsdk.maps.model.PolygonOptions;
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
import com.tencent.tencentmap.mapsdk.maps.model.RestrictBoundsFitMode;
import com.tencent.tencentmap.mapsdk.maps.model.TencentMapGestureListener;
import com.tencent.tencentmap.mapsdk.maps.model.TileOverlay;
import com.tencent.tencentmap.mapsdk.maps.model.TileOverlayOptions;
import com.tencent.tencentmap.mapsdk.maps.model.VectorHeatOverlay;
import com.tencent.tencentmap.mapsdk.maps.model.VectorHeatOverlayOptions;
import com.tencent.tencentmap.mapsdk.maps.model.VectorOverlay;
import com.tencent.tencentmap.mapsdk.maps.model.VectorOverlayProvider;

import java.io.IOException;
import java.util.List;

public class MarkerActivity extends AppCompatActivity implements TencentMap {
    TextureMapView textureMapView;
    TencentMap mTencentMap;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_marker);
        TencentMapInitializer.setAgreePrivacy(true);
        textureMapView=(TextureMapView)findViewById(R.id.view3) ;
        mTencentMap = textureMapView.getMap();
    }

    @Override
    public TencentMapContext getMapContext() {
        return null;
    }

    @Override
    public <T extends TencentMapComponent.Component> T getMapComponent(Class<T> aClass) {
        return null;
    }

    @Override
    public CameraPosition getCameraPosition() {
        return null;
    }

    @Override
    public float getZoomToSpanLevel(LatLng latLng, LatLng latLng1) {
        return 0;
    }

    @Override
    public float getMaxZoomLevel() {
        return 0;
    }

    @Override
    public float getMinZoomLevel() {
        return 0;
    }

    @Override
    public void setOnTapMapViewInfoWindowHidden(boolean b) {

    }

    @Override
    public void moveCamera(CameraUpdate cameraUpdate) {

    }

    @Override
    public void animateCamera(CameraUpdate cameraUpdate) {

    }

    @Override
    public void animateCamera(CameraUpdate cameraUpdate, CancelableCallback cancelableCallback) {

    }

    @Override
    public void animateCamera(CameraUpdate cameraUpdate, long l, CancelableCallback cancelableCallback) {

    }

    @Override
    public void stopAnimation() {

    }

    @Override
    public TileOverlay addTileOverlay(TileOverlayOptions tileOverlayOptions) {
        return null;
    }

    @Override
    public CustomLayer addCustomLayer(CustomLayerOptions customLayerOptions) {
        return null;
    }

    @Override
    public Polyline addPolyline(PolylineOptions polylineOptions) {
        return null;
    }

    @Override
    public Polygon addPolygon(PolygonOptions polygonOptions) {
        return null;
    }

    @Override
    public Circle addCircle(CircleOptions circleOptions) {
        return null;
    }

    @Override
    public Marker addMarker(MarkerOptions markerOptions) {

        return null;
    }

    @Override
    public List<Marker> getScreenMarkers() {
        return null;
    }

    @Override
    public Arc addArc(ArcOptions arcOptions) {
        return null;
    }

    @Override
    public void clearAllOverlays() {

    }

    @Override
    public void clear() {

    }

    @Override
    public void clearCache() {

    }

    @Override
    public void setMapType(int i) {

    }

    @Override
    public int getMapType() {
        return 0;
    }

    @Override
    public void setMapStyle(int i) {

    }

    @Override
    public int getMapStyle() {
        return 0;
    }

    @Override
    public boolean isTrafficEnabled() {
        return false;
    }

    @Override
    public void setTrafficEnabled(boolean b) {

    }

    @Override
    public void setTrafficMode(int i, int i1) {

    }

    @Override
    public void setMapFontSize(MapFontSize mapFontSize) {

    }

    @Override
    public void setSatelliteEnabled(boolean b) {

    }

    @Override
    public boolean isSateLiteEnable() {
        return false;
    }

    @Override
    public UiSettings getUiSettings() {
        return null;
    }

    @Override
    public Projection getProjection() {
        return null;
    }

    @Override
    public VisualSettings getVisualSettings() {
        return null;
    }

    @Override
    public void setOnCameraChangeListener(OnCameraChangeListener onCameraChangeListener) {

    }

    @Override
    public void setOnScaleViewChangedListener(OnScaleViewChangedListener onScaleViewChangedListener) {

    }

    @Override
    public void setOnMapClickListener(OnMapClickListener onMapClickListener) {

    }

    @Override
    public void setOnMapLongClickListener(OnMapLongClickListener onMapLongClickListener) {

    }

    @Override
    public void setOnPolylineClickListener(OnPolylineClickListener onPolylineClickListener) {

    }

    @Override
    public void setOnPolygonClickListener(OnPolygonClickListener onPolygonClickListener) {

    }

    @Override
    public void setOnCompassClickedListener(OnCompassClickedListener onCompassClickedListener) {

    }

    @Override
    public void setOnMapFrameFinished(OnMapFrameFinishCallback onMapFrameFinishCallback) {

    }

    @Override
    public void setOnMapLoadedCallback(OnMapLoadedCallback onMapLoadedCallback) {

    }

    @Override
    public void addOnMapLoadedCallback(OnMapLoadedCallback onMapLoadedCallback) {

    }

    @Override
    public void removeOnMapLoadedCallback(OnMapLoadedCallback onMapLoadedCallback) {

    }

    @Override
    public void snapshot(SnapshotReadyCallback snapshotReadyCallback) {

    }

    @Override
    public void snapshot(SnapshotReadyCallback snapshotReadyCallback, Bitmap.Config config) {

    }

    @Override
    public void snapshot(SnapshotReadyCallback snapshotReadyCallback, Bitmap.Config config, int i) {

    }

    @Override
    public String getCityName(LatLng latLng) {
        return null;
    }

    @Override
    public void setTencentMapGestureListener(TencentMapGestureListener tencentMapGestureListener) {

    }

    @Override
    public void addTencentMapGestureListener(TencentMapGestureListener tencentMapGestureListener) {

    }

    @Override
    public void removeTencentMapGestureListener(TencentMapGestureListener tencentMapGestureListener) {

    }

    @Override
    public CameraPosition calculateZoomToSpanLevel(List<IOverlay> list, List<LatLng> list1, int i, int i1, int i2, int i3) {
        return null;
    }

    @Override
    public String getVersion() {
        return null;
    }

    @Override
    public void showBuilding(boolean b) {

    }

    @Override
    public void setBuildingEnable(boolean b) {

    }

    @Override
    public void setBuilding3dEffectEnable(boolean b) {

    }

    @Override
    public void setBuildingBlackList(List<LatLngBounds> list) {

    }

    @Override
    public void setMapCenterAndScale(float v, float v1, float v2) {

    }

    @Override
    public void setPadding(int i, int i1, int i2, int i3) {

    }

    @Override
    public void setPadding(int i, int i1, int i2, int i3, boolean b) {

    }

    @Override
    public Rect getMapPadding() {
        return null;
    }

    @Override
    public List<LatLng> getBounderPoints(Marker marker) {
        return null;
    }

    @Override
    public Language getLanguage() {
        return null;
    }

    @Override
    public void setLanguage(Language language) {

    }

    @Override
    public void setOnMarkerClickListener(OnMarkerClickListener onMarkerClickListener) {

    }

    @Override
    public void setOnMarkerDragListener(OnMarkerDragListener onMarkerDragListener) {

    }

    @Override
    public void setOnMarkerCollisionStatusListener(OnMarkerCollisionStatusListener onMarkerCollisionStatusListener) {

    }

    @Override
    public void setOnInfoWindowClickListener(OnInfoWindowClickListener onInfoWindowClickListener) {

    }

    @Override
    public void setInfoWindowAdapter(InfoWindowAdapter infoWindowAdapter) {

    }

    @Override
    public boolean isMyLocationEnabled() {
        return false;
    }

    @Override
    public void setMyLocationEnabled(boolean b) {

    }

    @Override
    public Location getMyLocation() {
        return null;
    }

    @Override
    public void setLocationSource(LocationSource locationSource) {

    }

    @Override
    public void setMyLocationStyle(MyLocationStyle myLocationStyle) {

    }

    @Override
    public void setMyLocationClickListener(OnMyLocationClickListener onMyLocationClickListener) {

    }

    @Override
    public void setOnMyLocationChangeListener(OnMyLocationChangeListener onMyLocationChangeListener) {

    }

    @Override
    public void setLocationCompassHidden(boolean b) {

    }

    @Override
    public void setLocationNavigationGravityLineHidden(boolean b) {

    }

    @Override
    public void setOnMapPoiClickListener(OnMapPoiClickListener onMapPoiClickListener) {

    }

    @Override
    public void setOnVectorOverlayClickListener(OnVectorOverlayClickListener onVectorOverlayClickListener) {

    }

    @Override
    public void setCameraCenterProportion(float v, float v1) {

    }

    @Override
    public void setCameraCenterProportion(float v, float v1, boolean b) {

    }

    @Override
    public void setPointToCenter(int i, int i1) {

    }

    @Override
    public void setMaxZoomLevel(int i) {

    }

    @Override
    public void setMinZoomLevel(int i) {

    }

    @Override
    public void enableAutoMaxSkew(boolean b) {

    }

    @Override
    public void loadKMLFile(String s) {

    }

    @Override
    public void setDrawPillarWith2DStyle(boolean b) {

    }

    @Override
    public void setBlockRouteEnabled(boolean b) {

    }

    @Override
    public boolean isBlockRouteEnabled() {
        return false;
    }

    @Override
    public void setHandDrawMapEnable(boolean b) {

    }

    @Override
    public boolean isHandDrawMapEnable() {
        return false;
    }

    @Override
    public void enableMultipleInfowindow(boolean b) {

    }

    @Override
    public int getMapWidth() {
        return 0;
    }

    @Override
    public int getMapHeight() {
        return 0;
    }

    @Override
    public void setForeignLanguage(Language language) {

    }

    @Override
    public void setSceneByTag(String s) {

    }

    @Override
    public String getDebugError() {
        return null;
    }

    @Override
    public void setPoisEnabled(boolean b) {

    }

    @Override
    public void setRestrictBounds(LatLngBounds latLngBounds, RestrictBoundsFitMode restrictBoundsFitMode) {

    }

    @Override
    public void setOnTrafficEventClickListener(OnTrafficEventClickListener onTrafficEventClickListener) {

    }

    @Override
    public void setCustomRender(CustomRender customRender) {

    }

    @Override
    public VectorHeatOverlay addVectorHeatOverlay(VectorHeatOverlayOptions vectorHeatOverlayOptions) {
        return null;
    }

    @Override
    public <L extends VectorOverlay> L addVectorOverlay(VectorOverlayProvider vectorOverlayProvider) {
        return null;
    }

    @Override
    public void updateVectorOverlay(VectorOverlay vectorOverlay, VectorOverlayProvider vectorOverlayProvider) {

    }

    @Override
    public GroundOverlay addGroundOverlay(GroundOverlayOptions groundOverlayOptions) {
        return null;
    }

    @Override
    public VisualLayer addVisualLayer(VisualLayerOptions visualLayerOptions) {
        return null;
    }

    @Override
    public String executeVisualLayerCommand(VisualLayer visualLayer, String s) {
        return null;
    }

    @Override
    public AoiLayer addAoiLayer(String s, AoiLayerOptions aoiLayerOptions, AoiLayer.OnAoiLayerLoadListener onAoiLayerLoadListener) {
        return null;
    }

    @Override
    public void setBaseMapEnabled(boolean b) {

    }

    @Override
    public void setOverSeaTileProvider(OverSeaTileProvider overSeaTileProvider) {

    }

    @Override
    public void setMapFrameRate(float v) {

    }

    @Override
    public void setOverSeaEnable(boolean b) {

    }

    @Override
    public void setIndoorEnabled(boolean b) {

    }

    @Override
    public void setIndoorMaskColor(int i) {

    }

    @Override
    public void setIndoorFloor(int i) {

    }

    @Override
    public void setIndoorFloor(String s, String s1) {

    }

    @Override
    public int getIndoorFloorId() {
        return 0;
    }

    @Override
    public String[] getActivedIndoorFloorNames() {
        return new String[0];
    }

    @Override
    public String getActivedIndoorBuilding(LatLng latLng) {
        return null;
    }

    @Override
    public void setOnIndoorStateChangeListener(OnIndoorStateChangeListener onIndoorStateChangeListener) {

    }

    @Override
    public void setIndoorCellInfo(List<IndoorCellInfo> list) {

    }

    @Override
    public void resetIndoorCellInfo() {

    }

    @SuppressLint("IntentReset")
    public void AddMarker(View view) throws IOException, PendingIntent.CanceledException {
        LatLng position = new LatLng(39.908710,116.397499);
        CameraUpdate cameraSigma =
                CameraUpdateFactory.newCameraPosition(new CameraPosition(position
                        , //中心点坐标，地图目标经纬度
                        19,  //目标缩放级别
                        0f, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
                        0f)); //目标旋转角 0~360° (正北方为0)
        mTencentMap.moveCamera(cameraSigma);
        BitmapDescriptor custom = BitmapDescriptorFactory.fromResource(R.drawable.icon);
        MarkerOptions options = new MarkerOptions(position);
        options.title("天安门")//标注的InfoWindow的标题
                .snippet("地址: 北京市东城区东长安街").icon(custom)//标注的InfoWindow的内容
        ;//设置自定义Marker图标
        Marker marker = mTencentMap.addMarker(options);
        //开启信息窗口
        mTencentMap.setOnMarkerClickListener(new TencentMap.OnMarkerClickListener(){
            @Override
            public boolean onMarkerClick(Marker marker) {
                Log.d(getLocalClassName()+":", "marker");
                return false;
            }
        });
//设置Marker支持点击
        marker.setClickable(true);
        Log.d(getLocalClassName()+":", "AddMarker(View view)");
    }
}